<template>
	<view class="user">
		<view class="header">
			<u-avatar :src="userInfo.avatarUrl" size="large" class="avatar"></u-avatar>
		</view>
		<u-cell-group>
			<u-cell-item icon="setting-fill" title="个人设置"></u-cell-item>
			<u-cell-item icon="file-text" title="我的订单"></u-cell-item>
		</u-cell-group>
		<Login ref='login'></Login>
	</view>
</template>

<script>
	import Login from "../login/index.vue"
	export default {
		components:{
			Login
		},
		data() {
			return {
				userInfo:null,
			}
		},
		onShow() {
			this.$refs.login.authorize()
		},
		onLoad() {
			try {
			    const value = uni.getStorageSync('userInfo');
			    if (value) {
			        console.log(value);
					this.userInfo = value
			    }
			} catch (e) {
			    // error
			}
		},
		methods: {

		}
	}
</script>
<style lang="scss" scoped>
	.user{
		.header{
			background-color: #F1F1F1;
			text-align: center;
			padding: 50rpx 0;
			.avatar{
				display: block;
			}
		}
	}
</style>
